<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>客服留言</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        [v-clock] {
            display: none;
        }

        html {
            font-size: calc(100vw / 7.5);
        }

        html,
        body {
            width: 100%;
            height: 100%;
            overflow: hidden;
            background: #f5f5f5;
        }

        #app {
            width: 100%;
            height: 100%;
            overflow-y: scroll;
            overflow-x: hidden;
            font-size: 0.32rem;
        }

        .page_tt {
            font-size: 0.4rem;
            text-align: center;
            padding: 0.4rem 0;
        }

        .line {
            height: 0.02rem;
            background: #ddd;
        }

        .block3 {
            background: #fff;
            border-radius: 0.2rem;
            margin: 0 0.3rem;
        }

        .form_item {
            display: flex;
            font-size: 0.28rem;
            padding: 0 0.2rem;
        }

        .form_label {
            font-weight: bold;
            width: 1.2rem;
            line-height: 1rem;
        }

        .input {

            height: 1rem;
        }

        .textarea {
            height: 2rem;
            padding: 0.2rem 0;
            font-family: inherit;
        }

        .input,
        .textarea {
            flex: 1;
            border: none;
            outline: none;
        }

        .btn_block,
        .btn2_block {
            font-size: 0.36rem;
            height: 1rem;
            border-radius: 0.5rem;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0.32rem 0.3rem 0;
        }

        .btn_block {
            background-color: #e80c30;
        }

        .btn2_block {
            color: #000;
            background-color: #E6E6E6;
        }

        .tips {
            color: #999;
            font-size: 0.24rem;
            margin: 0.1rem 0.3rem 0;
        }
    </style>
</head>

<body>
<div id="app" v-clock>
    <h1 class="page_tt">视频黄金会员特惠卡</h1>
    <div class="block3">
        <div class="form_item">
            <div class="form_label">手机号</div>
            <input class="input" maxlength="11" v-model="phone" placeholder="请输入手机号" type="tel">
        </div>
        <div class="line"></div>
        <div class="form_item">
            <div class="form_label">留言</div>
            <textarea class="textarea" placeholder="留言内容" v-model="msg"></textarea>
        </div>
    </div>
    <div class="tips">*当前客服不在线，有事请留言，客服稍后会主动联系您</div>
    <div class="btn_block" @click="submit">提交</div>
    <div class="btn2_block" @click="goback">取消</div>
</div>
</body>
<script src="js/vue@2.js"></script>
<script src="js/utils.min.js"></script>
<script src="js/config.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            phone: "",
            msg: ''
        },
        mounted() {

        },
        methods: {
            goback() {
                history.back();
            },
            submit() {
                if (!this.phone || !this.msg) {
                    showToast('请填写完整表单')
                    return
                }
                ajax({
                    url: domain + "/api/bu/leave",
                    type: "post",
                    data: {
                        phone: this.phone,
                        leaveMessage: this.msg,
                    },
                    success: (res) => {
                        if (res.code == 1) {
                            showToast("提交成功，客服会主动联系您，请耐心等待", 2500);
                            this.phone = '';
                            this.msg = '';
                        }else {
                            showToast(res.msg)
                        }
                    },
                    //异常处理
                    error: (e) => {
                        showToast("请求错误");
                    },
                });
            }
        }
    })
</script>

</html>